package com.zzg.pattern.entity;

import java.util.ArrayList;
import java.util.List;

import com.zzg.pattern.component.Component;

public class Folder implements Component {
	private String name;
	private List<Component> list = new ArrayList<Component>();
	
	public Folder(String name) {
		super();
		this.name = name;
	}

	public void add(Component component){
        list.add(component);
    }
    public void remove(Component component){
        list.remove(component);
    }
    public Component getChild(int index){
        return list.get(index); 
    }


	@Override
	public void operation() {
		// TODO Auto-generated method stub
		for(Component component : list){
			component.operation();
		}
	}

}
